package org.wattdepot.cli.command;

import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.wattdepot.cli.CommandLineInterface;

/**
 * Test that checks for valid output within the Help class.
 * 
 * @author Anthony Xu & John Mack
 * 
 */
public class TestHelp {


  /**
   * Test to see if the help command displays correct output.
   * @throws Exception NotAuthorizedException, ResourceNotFoundException, 
   *                   BadXmlException, MiscClientException.
   */
  @Test
  public void testHelp() throws Exception {
    CommandLineInterface cli = new CommandLineInterface();
    List<String> commands = new ArrayList<String>();
    commands.add("help");
    
    String helpString = new Help().doCommand(cli, commands);

  assertEquals(
    "correct output", "help" + "\n" +
    "This message" + "\n" +
    "quit" + "\n" +
    "Exits the system" + "\n"  +
    "sources" + "\n"  +
    "Prints a table summarizing the public sources in the system, one per line." + "\n"  +
    "source {source} summary" + "\n"  +
    "Prints information about a single source." + "\n"  +
    "sensordata {source} timestamp {timestamp}" + "\n"  +
    "Prints information about a single sensor data instance." + "\n"  +
    "dailysensordata {source} day {day}" + "\n"  +
    "Prints a table listing all of the sensor data instances for the specified day." + "\n"  +
    "power {source} timestamp {timestamp}" + "\n"  +
    "Prints the power generated by the source at the given timestamp." + "\n"  +
    "powerstats [generated|consumed] {source} day {day} sampling-interval {minutes} statistic" +
    " {max|min|average}" + "\n" +
    "Returns the maximum, minimum, or average power generated by the source for the day." + "\n" +
    "total [carbon|energy] {source} day {day} sampling-interval {minutes}" + "\n" +
    "Returns the total amount of carbon (or energy) emitted by this source" +
    " for the given day." + "\n" +
    "chart power [generated|consumed] {source} {startday} {endday} sampling-interval" +
    " {minutes} file {file}" + "\n" +
    "Writes out an html file that will display a chart illustrating the power" +
    " for the source over the interval." + "\n" + "fueltypes {source}" + "\n" +
    "Returns a table of fuels associated with this source." + "\n" +
    "totalpower {source} {timestamp} fuelType {fuelType}" + "\n" + 
    "Returns the total power generated by the given fuel type." + "\n" +
    "carboncontent {source} {timestamp} sampling-interval {interval}." + "\n" +
    "Returns the total carbon that would be emitted by that source over an hour at the rate " +
    "occurring as of the timestamp. ", helpString);
  
  }
    
}
